package com.mem.app.model;
// Generated 21/Ago/2015 19:35:12 by Hibernate Tools 4.3.1

import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Evento generated by hbm2java
 */
@Entity
@Table(name = "evento", catalog = "memdb")
public class Evento implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private EventoId id;
	private Familiar familiar;
	private Morada morada;
	private Paciente paciente;
	private Date data;
	private String tipoEvento;
	private String descricao;

	public Evento() {
	}

	public Evento(EventoId id, Familiar familiar, Morada morada, Paciente paciente) {
		this.id = id;
		this.familiar = familiar;
		this.morada = morada;
		this.paciente = paciente;
	}

	public Evento(EventoId id, Familiar familiar, Morada morada, Paciente paciente, Date data, String tipoEvento,
			String descricao) {
		this.id = id;
		this.familiar = familiar;
		this.morada = morada;
		this.paciente = paciente;
		this.data = data;
		this.tipoEvento = tipoEvento;
		this.descricao = descricao;
	}

	@EmbeddedId

	@AttributeOverrides({ @AttributeOverride(name = "idEvento", column = @Column(name = "idEvento", nullable = false) ),
			@AttributeOverride(name = "idPaciente", column = @Column(name = "idPaciente", nullable = false) ) })
	public EventoId getId() {
		return this.id;
	}

	public void setId(EventoId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idFamiliar", nullable = false)
	public Familiar getFamiliar() {
		return this.familiar;
	}

	public void setFamiliar(Familiar familiar) {
		this.familiar = familiar;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idLocalEvento", nullable = false)
	public Morada getMorada() {
		return this.morada;
	}

	public void setMorada(Morada morada) {
		this.morada = morada;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idPaciente", nullable = false, insertable = false, updatable = false)
	public Paciente getPaciente() {
		return this.paciente;
	}

	public void setPaciente(Paciente paciente) {
		this.paciente = paciente;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "data", length = 10)
	public Date getData() {
		return this.data;
	}

	public void setData(Date data) {
		this.data = data;
	}

	@Column(name = "tipoEvento", length = 45)
	public String getTipoEvento() {
		return this.tipoEvento;
	}

	public void setTipoEvento(String tipoEvento) {
		this.tipoEvento = tipoEvento;
	}

	@Column(name = "descricao", length = 45)
	public String getDescricao() {
		return this.descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

}
